	<script>
	$(function() {
		$( "#datepicker" ).datepicker();
		$( "#datepicker1" ).datepicker();
		$( "#datepicker2" ).datepicker();
		$( "#datepicker3" ).datepicker();
		$( "#datepicker4" ).datepicker();
		$( "#datepicker5" ).datepicker();
	});
	</script>
	

<script type="text/javascript">

	
function numberFormat(nStr){
  nStr += '';
  x = nStr.split('.');
  x1 = x[0];
  x2 = x.length > 1 ? '.' + x[1] : '';
  var rgx = /(\d+)(\d{3})/;
  while (rgx.test(x1))
    x1 = x1.replace(rgx, '$1' + ',' + '$2');
  return x1 + x2;
}

</script>
<script type="text/javascript">
     var chart;
     var f;
     f = $("#nhan_biet").val();
   //  alert(f);
     $(document).ready(function() {
    	       $("#form_an1").hide();
    	       $("#form_an2").hide();
    	      
    	       $("#dong_2").hide();
    	       $("#dong_3").hide();
    	       $("#dong_4").hide();
    	       $("#dong_5").hide();
    	       $("#dong_6").hide();
    	       $("#dong_7").hide();
    	       var test_site = $("#test_site").val();
               var select_chart = $("#model_chart").val();
               if(select_chart == 1){
            //	   $("#container").remove();
            //     $("#bang_2").hide();
            //     $("#bang_1").hide();
                  	$("#form_container").show();
                  	$("#form_an2").hide();
                  	$("#form_an1").show();
               }
               if(select_chart == 2){
            	//  $("#container").remove();
                //  $("#bang_1").hide();
                //  $("#bang_2").hide();
                  	$("#form_an1").hide();
                    $("#form_an2").show();
               }
               var select_time = $("#time").val();
               if(select_time == 1){
            	   $("#dong_2").hide();
        	       $("#dong_3").hide();
               }
               if(select_time == 2){
            	   $("#dong_2").show();
              	   $("#dong_3").show();
               }

               var select_time1 = $("#time1").val();
               if(select_time1 == 1){
            	   $("#dong_4").show();
        	       $("#dong_5").hide();
        	       $("#dong_6").hide();
        	       $("#dong_7").hide();
               }
               if(select_time1 == 2){
            	   $("#dong_4").hide();
        	       $("#dong_5").show();
        	       $("#dong_6").hide();
        	       $("#dong_7").hide();
               }
               if(select_time1 == 3){
            	   $("#dong_4").hide();
        	       $("#dong_5").hide();
        	       $("#dong_6").show();
        	       $("#dong_7").show();
               }
              
               var test = $("#test").val();
    	       if(test ==  1){
				// alert(a1);
				var a = $("#temp_name").val();
				var b = $("#temp_value").val();
				
				// alert(f);
				var mang = a.split("/");
				var n;
				var temp = new Array();
			    var giatri = b.split(" ");  // alert(giatri[0]); alert(giatri[1]);
			    n = giatri.length;
			    for(var i = 0; i < n-1 ; i++)
			    {
                      temp[i] = parseFloat(giatri[i]);
                  //    temp_name[i] = parseFloat(giatri[i]);
			    }
			    var tam = new Array();
			    for(var i = 0; i < n-1 ; i++)
			    {
                    tam[i] = {
	                 		   name: mang[i],
	                		   data: temp[i]
	                		 }; 
			    }
					    chart = new Highcharts.Chart({
							chart: {
								renderTo: 'container',
								defaultSeriesType: 'bar'
							},
							title: {
								text: 'BIỂU ĐỒ SO SÁNH LƯỢT DOWNLOAD TRÊN CÁC KÊNH'
							},
							subtitle: {
								text: 'Source: HẢI-PRO'
							},
							xAxis: {
								categories: [' ', ' '],
								title: {
									text: null
								}
							},
							yAxis: {
								min: 0,
								title: {
									text: 'Lượt download',
									align: 'high'
								}
							},
							tooltip: {
								formatter: function() {
									return ''+
										 this.series.name +': '+ numberFormat(this.y) + ' Lượt download' ;
								}
							},
							plotOptions: {
								bar: {
									dataLabels: {
										enabled: true
									}
								}
							},
							legend: {
								layout: 'vertical',
								align: 'right',
								verticalAlign: 'top',
								x: -100,
								y: 100,
								floating: true,
								borderWidth: 1,
								backgroundColor: '#FFFFFF',
								shadow: true
							},
							credits: {
								enabled: false
							},
							series: tam
						}); 
				
    	   }
    	   
			if(test == 2){
				var so_phan_tu = $("#so_phan_tu").val();
			//	alert(so_phan_tu);
			    var a1 = $("#temp_name1").val();
//				var b1 = $("#temp_value1").val();
			    var mang_1 = new Array();
			    var hang;
			    var mang_gia_tri =  new Array();
			    var mang_so_phan_tu =  new Array();
			    for(var k = 0 ; k <so_phan_tu ; k++)
			    {
				    hang = "temp_value";
				    var ma_id = hang.concat(k); // alert(ma_id);
				    mang_1[k] = $("#" + ma_id).val();// alert(mang_1[k]);
				    mang_gia_tri[k] =  mang_1[k].split(" "); // alert(mang_gia_tri[k]);
				    mang_so_phan_tu[k] =  mang_gia_tri[k].length;
				   // alert(mang_1[k]);
			    }
			    
				var mang1 = a1.split("/");
				
				var temp1 = new Array();
			 //   var giatri1 = b1.split(" ");  // alert(giatri[0]); alert(giatri[1]);

				 var hang2 = "mang_temp";
				var mang_tam1 = new Array();
				var mang_hai_chieu = new Array();

				
			    for(var i = 0; i < so_phan_tu ; i++)
			    {
			    	mang_hai_chieu[i] = new Array();
				      for(var j=0; j < mang_gia_tri[i].length - 1; j++)
				      {
					    //  alert(mang_gia_tri[i][j]);
					      // alert(parseFloat(mang_gia_tri[i][j]));
				    	  mang_hai_chieu[i][j] = (parseFloat(mang_gia_tri[i][j])); //alert(mang_tam1[j]);
				      }
				      
		 	           
			    }

			    var tam1 = new Array();
			    for(var t = 0; t < so_phan_tu ; t++)
			    {    // alert(mang1[i]);
			    	//alert(mang_hai_chieu[t]);
                    tam1[t] = { 
	                 		   name: mang1[t],
	                		   data: mang_hai_chieu[t]
          		   			  
	                		 }; 
			    }
					    chart = new Highcharts.Chart({
							chart: {
								renderTo: 'container',
								defaultSeriesType: 'line',
								marginRight: 130,
								marginBottom: 25
							},
							title: {
								text: 'BIỂU ĐỒ TĂNG TRƯỞNG SẢN PHẨM',
								x: -20 //center
							},
							subtitle: {
								text: 'Source: HẢI-PRO',
								x: -20
							},
							xAxis: {
								categories: [' ', ' '],
								
							},
							yAxis: {
								title: {
									text: 'Lượt download'
								},
								plotLines: [{
									value: 0,
									width: 1,
									color: '#808080'
								}]
							},
							tooltip: {
								formatter: function() {
						                return '<b>'+ this.series.name +'</b><br/>'+
										this.x +': '+ numberFormat(this.y) + ' Lượt download' ;
								}
							},
							legend: {
								layout: 'vertical',
								align: 'right',
								verticalAlign: 'top',
								x: -10,
								y: 100,
								borderWidth: 0
							},
							series: tam1
							
						});
			   
              
			} 
				
			});
</script>